hysop.backend.device.opencl.opencl_array module

class hysop.backend.device.opencl.opencl_array.OpenClArray(handle, backend, **kargs)[source]

Bases: Array

OpenCl memory array wrapper (pyopencl.array.Array).

Parameters:
  • handle (pyopencl.array.Array, implementation of this array)

  • kargs (arguments for base classes.)

property T

Same as self.transpose(), except that self is returned if self.ndim < 2.

add_event(evt)[source]

Add evt to events. If events is too long, this method may implicitly wait for a subset of events and clear them from the list.

as_symbolic_array(name, **kwds)[source]

Return a symbolic array variable that contain a reference to this array.

as_symbolic_buffer(name, **kwds)[source]

Return a symbolic buffer variable that contain a reference to this array.

astype(dtype, queue=None, order=SAME_ORDER(3), casting='unsafe', subok=True, copy=True)[source]

Copy of the array, cast to a specified type.

property base

Base object if memory is from some other object.

property base_data
property context

Get the opencl context associated to this array.

ctype()[source]

Equivalent C type corresponding to the numpy.dtype.

property data

Buffer object pointing to the start of the array’s data

property default_queue

Get the default queue for this array.

property device

Get the opencl device associated to this array.

property dtype

numpy.dtype representing the type stored into this buffer.

events()[source]

A list of pyopencl.Event instances that the current content of this array depends on. User code may read, but should never modify this list directly. To update this list, instead use the following methods.

finish()[source]

Wait for the entire contents of events, clear it.

property flags

Information about the memory layout of the array.

get(handle=False, queue=None, ary=None)[source]

Returns a HostArray, view or copy of this array.

get_T()[source]

Same as self.transpose(), except that self is returned if self.ndim < 2.

get_base()[source]

Base object if memory is from some other object.

get_base_data()[source]
get_context()[source]

Get the opencl context associated to this array.

get_data()[source]

Buffer object pointing to the start of the array’s data

get_default_queue()[source]

Get the default queue for this array.

get_device()[source]

Get the opencl device associated to this array.

get_dtype()[source]

numpy.dtype representing the type stored into this buffer.

get_flags()[source]

Information about the memory layout of the array.

get_imag()[source]

The imaginary part of the array.

get_int_ptr()[source]

Return the underlying buffer pointer as an int.

get_nbytes()[source]

Number of bytes in the whole buffer.

get_ndim()[source]

Number of array dimensions.

get_offset()[source]

Offset of array data in buffer.

get_real()[source]

The real part of the array.

get_shape()[source]

The real shape of this buffer.

get_size()[source]

Number of elements in the array.

get_strides()[source]

Tuple of ints that represents the byte step in each dimension when traversing an array.

property imag

The imaginary part of the array.

property int_ptr

Return the underlying buffer pointer as an int.

max(axis=None, out=None, queue=None, synchronize=True, **kwds)[source]

Return the maximum along a given axis. On the first call, a kernel launcher is built for efficiency.

min(axis=None, out=None, queue=None, synchronize=True, **kwds)[source]

Return the minimum along a given axis. On the first call, a kernel launcher is built for efficiency.

nanmax(axis=None, out=None, queue=None, synchronize=True, **kwds)[source]

Return the maximum along a given axis. On the first call, a kernel launcher is built for efficiency.

nanmin(axis=None, out=None, queue=None, synchronize=True, **kwds)[source]

Return the minimum along a given axis. On the first call, a kernel launcher is built for efficiency.

property nbytes

Number of bytes in the whole buffer.

property ndim

Number of array dimensions.

property offset

Offset of array data in buffer.

property real

The real part of the array.

reset_default_queue()[source]

Resets the default queue for this array.

reshape(shape, order=C_CONTIGUOUS(0))[source]

Returns view of array with the same data. If dtype is different from current dtype, the actual bytes of memory will be reinterpreted.

set_default_queue(queue)[source]

Sets the default queue for this array.

set_shape(shape)[source]

Set the shape of this buffer. From the numpy doc: It is not always possible to change the shape of an array without copying the data. If you want an error to be raised if the data is copied, you should assign the new shape to the shape attribute of the array.

setitem(subscript, value, queue=None)[source]
property shape

The real shape of this buffer.

property size

Number of elements in the array.

property strides

Tuple of ints that represents the byte step in each dimension when traversing an array.

sum(axis=None, out=None, queue=None, synchronize=True, **kwds)[source]

Return the sum along a given axis. On the first call, a kernel launcher is built for efficiency.

view(dtype=None)[source]

Returns view of array with the same data. If dtype is different from current dtype, the actual bytes of memory will be reinterpreted.

with_queue()[source]

Return a copy of self with the default queue set to queue.